package com.jf.dao.impl;

import com.jf.bean.Kaptcha;
import com.jf.dao.KaptchaDao;
import com.jf.util.BaseDao;

public class KaptchaDaoImpl implements KaptchaDao {
    @Override
    public int add(Kaptcha kaptcha) {
        String sql = "insert into kaptcha values(?,?,?)";
        return BaseDao.baseUpdate(sql,kaptcha.getUuid(),kaptcha.getText(),kaptcha.getExpires());
    }

    @Override
    public Kaptcha getByUUID(String uuid) {
        return BaseDao.baseQueryBean(Kaptcha.class,"select * from kaptcha where uuid = ?",uuid);
    }

    @Override
    public int delete(String uuid) {
        return BaseDao.baseUpdate("delete from kaptcha where uuid = ?",uuid);
    }
}
